package com.hanamaki.day1.testng;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;


public class FireFoxDriverTest {

        //注册驱动
        WebDriver driver;

        @BeforeMethod
        public void setUp(){

            //注册本地火狐打开的位置
            System.setProperty("webdriver.gecko.driver", "C:\\Program Files\\Mozilla Firefox\\geckodriver.exe");
            //初始化
            driver = new FirefoxDriver();
        }

        @Test
        public void test() {
            driver.get("https://www.baidu.com");

            driver.findElement(By.id("kw")).sendKeys("hello");
            driver.findElement(By.id("su")).click();
        }


        @AfterMethod
        public void close() {
            driver.close();
        }
    }

